<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags"  prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>角色列表</title>
</head>
<script type="text/javascript" src="/jquery_lib/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
	function getPermission(id){
		$.get("permission_list?id="+id,function(data,status,ajaxObject){
			var jsons = eval("("+ajaxObject.responseText+")");
			var table = $("#permission_table");
			table.html("<tr><td>ID</td><td>名字</td><td>资源</td></tr>");
			for(var i=0;i<jsons.length;i++){
				var json = jsons[i];
				var temp = "<tr><td>"+json.id+"</td><td>"+json.name+"</td><td>"+json.resource+"</td></tr>";
				$(temp).appendTo(table);
			}
			
		},"json");
	}
	
	function addPermission(id){
		window.showModalDialog("permission_addPermissionToRole",id,"dialogWidth:870px");
		
		
	}
</script>
<body>
	<table border="1" width="100%">
		<tr>
			<td colspan="4" align="center">角色列表</td>
		</tr>
		<s:iterator value="#roles" >
			<tr>
				<td ><s:property value="id"/></td>
				<td><s:property value="name"/></td>
				<td><a href="javascript:getPermission(<s:property value="id"/>)">查看权限</a>
					　　
					<a href="javascript:addPermission(<s:property value="id"/>)">添加权限</a>
				</td>
			</tr>
		</s:iterator>
	</table>
	</br></br>
	<fieldset>
	<legend align="left">角色对应的权限</legend>
	<table border="1" width="100%" id="permission_table">
	</table>
	</fieldset>
</body>
</html>